/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cms.dataaccess.hibernate;

import cms.dataaccess.ReviewLogDAO;
import cms.exceptions.HibernateAccessLayerException;
import dto.Reviewlog;
import java.util.List;

/**
 *
 * @author Gary
 */
class ReviewLogDAOImpl extends  AbstractDAO  implements ReviewLogDAO {

    public ReviewLogDAOImpl() {
    }

    @Override
    public boolean updateReiewLog(Reviewlog reviewLog) {
              try{
              
              this.delete(reviewLog);
              return true;
            } catch (Throwable t)
            {
            throw new HibernateAccessLayerException(t.toString());
            }
   
    }

    @Override
    public boolean deleteReviewLog(String reviewID) {
          try{
            Reviewlog   reviewLog =  (Reviewlog) this.find(Reviewlog.class, reviewID);
              this.delete(reviewLog);
              return true;
            } catch (Throwable t)
            {
            throw new HibernateAccessLayerException(t.toString());
            }
   
    }

    @Override
    public Reviewlog getReviewlog(String reviewID) {
         try{
            return (Reviewlog) this.find(Reviewlog.class, reviewID);
             
            } catch (Throwable t)
            {
            throw new HibernateAccessLayerException(t.toString());
            }
    }

    @Override
    public List<Reviewlog> getAllReviewlogs() {
         try{
            return  this.findAll(Reviewlog.class);
             
            } catch (Throwable t)
            {
            throw new HibernateAccessLayerException(t.toString());
            }
    }

   
    @Override
    public List<Reviewlog> findByCustomizeQuery(String query) {
            try{
            return  super.findByCustomizeQuery(Reviewlog.class,query);
             
            } catch (Throwable t)
            {
            throw new HibernateAccessLayerException(t.toString());
            }
    }
    
}
